var o, e = require, t = module, n = exports, i = this && this.__extends || (o = function(e, t) {
    return (o = Object.setPrototypeOf || {
        __proto__: []
    } instanceof Array && function(e, t) {
        e.__proto__ = t;
    } || function(e, t) {
        for (var o in t) t.hasOwnProperty(o) && (e[o] = t[o]);
    })(e, t);
}, function(e, t) {
    function n() {
        this.constructor = e;
    }
    o(e, t), e.prototype = null === t ? Object.create(t) : (n.prototype = t.prototype, 
    new n());
}), a = this && this.__decorate || function(e, t, o, n) {
    var a, i = arguments.length, s = i < 3 ? t : null === n ? n = Object.getOwnPropertyDescriptor(t, o) : n;
    if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) s = Reflect.decorate(e, t, o, n); else for (var r = e.length - 1; 0 <= r; r--) (a = e[r]) && (s = (i < 3 ? a(s) : 3 < i ? a(t, o, s) : a(t, o)) || s);
    return 3 < i && s && Object.defineProperty(t, o, s), s;
};

Object.defineProperty(n, "__esModule", {
    value: !0
});

var r = e("LoadManager"), s = e("Global"), c = e("PopBackItemView"), l = cc._decorator, d = l.ccclass, u = l.property, p = function(t) {
    function e() {
        var e = null !== t && t.apply(this, arguments) || this;
        return e.light = null, e.sprite = null, e.numLabel = null, e.imageList = [], e.skeleton = null, 
        e;
    }
    return i(e, t), e.prototype.init = function() {
        var t = this;
        if (this.scheduleOnce(this.closePnl, 3), cc.tween(this.light).repeatForever(cc.tween().by(2, {
            angle: 60
        })).start(), PD.checkNumParam("type")) switch (PD.data.type) {
          case s.RewardType.DIAMOND:
            this.showSprite(), 0 < this.imageList.length && (this.sprite.spriteFrame = this.imageList[0]), 
            PD.checkNumParam("num") && (this.numLabel.string = PD.data.num.toString());
            break;

          case s.RewardType.MONEY:
            break;

          case s.RewardType.SKIN:
            this.showSkeleton(), PD.checkNumParam("idx") && r.default.getInstance().loadRes({
                url: "skin/" + PD.data.idx + "/skeleton",
                type: sp.SkeletonData
            }).then(function(e) {
                t.skeleton && e instanceof sp.SkeletonData && t.skeleton.setSkeletonData(e);
            });
            break;

          case s.RewardType.PET:
            this.showSkeleton(), PD.checkNumParam("idx") && r.default.getInstance().loadRes({
                url: "skin/p" + PD.data.idx + "/dog",
                type: sp.SkeletonData
            }).then(function(e) {
                t.skeleton && e instanceof sp.SkeletonData && (t.skeleton.setSkeletonData(e), t.skeleton.setAnimation(0, "move2", !0));
            });
        }
    }, e.prototype.showSprite = function() {
        this.sprite.node.active = !0, this.skeleton.node.active = !1;
    }, e.prototype.showSkeleton = function() {
        this.sprite.node.active = !1, this.skeleton.node.active = !0;
    }, e.prototype.closePnl = function() {
        this.unschedule(this.closePnl), t.prototype.closePnl.call(this);
    }, a([ u(cc.Node) ], e.prototype, "light", void 0), a([ u(cc.Sprite) ], e.prototype, "sprite", void 0), 
    a([ u(cc.Label) ], e.prototype, "numLabel", void 0), a([ u([ cc.SpriteFrame ]) ], e.prototype, "imageList", void 0), 
    a([ u(sp.Skeleton) ], e.prototype, "skeleton", void 0), a([ d ], e);
}(c.default);

n.default = p;